#ifndef GAMEENGINE_GEOMETRY_CIRCLE2D_H
#define GAMEENGINE_GEOMETRY_CIRCLE2D_H

#include <GameEngine/Geometry/geometry_settings.h>

#include <GameEngine/Geometry/Location/point2d.h>
#include <GameEngine/Geometry/Lines/line2d.h>
#include <GameEngine/Geometry/Core/angle.h>


#ifdef GAMEENGINE_NAMESPACES
namespace GameEngine {
#endif

//! Class used to represent 2D circles
/*!
 @note A circle is represented by its center and its radius
 @note Most algorithms expect floating point operations. Type T should therefore
       not be an integer type
 */
template <class T>
class Circle2d {

public:
	Circle2d();
	Circle2d(const Point2d<T>& center, const T& radius);
	Circle2d(const Circle2d& rhs);
	virtual ~Circle2d();
	Circle2d& operator=(const Circle2d& rhs);

	Point2d<T>& center();
	const Point2d<T>& center() const;
	T& radius();
	const T& radius() const;

	T diameter() const;
	T area() const;

	bool inside(const Point2d<T>& rhs, bool strict = false) const;
	int intersection(const Line2d<T>& rhs, T& coordinate1, T& coordinate2, IntersectionType::Type* type = nil) const;

	Point2d<T> closest_point(const Point2d<T>& rhs) const;
	Point2d<T> point(const Angle<T>& angle) const;

protected:
	//! Center of the circle
	Point2d<T> center_;

	//! Radius of the circle
	T radius_;
};

#ifdef GAMEENGINE_NAMESPACES
} // namespace GameEngine
#endif

#include <GameEngine/Geometry/Surfaces/circle2d.hpp>

#endif
